package com.neusoft.elmboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.elmboot.po.OrderDetailet;
import com.neusoft.elmboot.service.OrderDetailetService;

import java.util.List;

@RestController
@RequestMapping("/OrderDetailetController")
public class OrderDetailetController {

    @Autowired
    private OrderDetailetService orderDetailetService;

    // 根据订单ID获取订单明细
    @RequestMapping("/listOrderDetailetByOrderId")
    public List<OrderDetailet> listOrderDetailetByOrderId(@RequestParam("orderId") Integer orderId) {
        return orderDetailetService.listOrderDetailetByOrderId(orderId);
    }

    // 批量保存订单明细
    @RequestMapping("/saveOrderDetailetBatch")
    public int saveOrderDetailetBatch(@RequestBody List<OrderDetailet> list) {
        return orderDetailetService.saveOrderDetailetBatch(list);
    }
}
